5-E
Simple site for the info you need...
  • Add Local Admin
  • Backup Dogecoin Wallet
  • Batch Start Powershell
  • Copy A File(s) To All Users On A PC
  • CPU Load Test
  • Disable Users
  • Email Group Members
  • Email With Powershell
  • Exchange Total Size
  • Export to XLSX
  • Export User Cert
  • Get System Info
  • Import Active Directory Module
  • Last Login For All Computer
  • Last Login For All Users
  • Last Login For Select Users
  • List Domain controllers
  • List Groups (With Count) In Active Directory To TXT
  • List Groups (With Count) In Active Directory To XLSX
  • List Groups For A User(s)
  • List Groups In Active Directory to TXT
  • List Home Directory
  • List Members In A Group(s)
  • Password Generator
  • Ping Test
  • Printer Reset
  • Run A Process Every Few Minutes
  • Search For Files On All Local Drives
  • Show iSCSI Device And Disk Number
  • Uninstall Java

Last Login For Computers

Check last logon time for computers and servers. First script lists all computers/servers that have logged on within 30 days. The second script lists computers/servers that have not logged on within 60 days. Each of them are piped to a CSV.
CODE:
import-module activedirectory 
$domain = "5-E.ME"  
$days = 30  
$time = (Get-Date).Adddays(-($days)) 
Get-ADComputer -Filter {LastLogonTimeStamp -gt $time} -Properties LastLogonTimeStamp,OperatingSystem |  
select-object Name,OperatingSystem,@{Name="Stamp"; Expression={[DateTime]::FromFileTime($_.lastLogonTimestamp)}} |  
export-csv Active-Computer.csv -notypeinformation 
Use at your own risk
CODE:
import-module activedirectory 
$domain = "5-E.ME"  
$days = 60  
$time = (Get-Date).Adddays(-($days)) 
Get-ADComputer -Filter {LastLogonTimeStamp -lt $time} -Properties LastLogonTimeStamp,OperatingSystem |  
select-object Name,OperatingSystem,@{Name="Stamp"; Expression={[DateTime]::FromFileTime($_.lastLogonTimestamp)}} |  
export-csv Obsolete-Computer.csv -notypeinformation 
Use at your own risk
Download: Last Login For All Computer.zip

Tag(s): Powershell


Could you spare a few coins?
Dogecoin - D838u1m9YRdzVVu8CZ1JsR78WHgQmUZSr8
Bitcoin - 13iKLoPXcWEYcGtqCi4UcjGQEs7r6M6LFc
Thank you
  • Home

  • Batch
  • Email
  • Exchange
  • How To
  • Local PC
  • Powershell
  • Security